package com.brokendust.client.config.module.text;

import com.brokendust.client.config.module.ComponentJson;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.ArrayList;
import java.util.List;

public class TextLabelJson implements ComponentJson {
    public String type;
    private String object_name;
    private float scale;
    private int position;
    private int x;
    private int y;
    private boolean vertical;
    private int row_height;
    private int line_spacing;
    private int align;
    private boolean reverse_sort;
    private List<String> text_list;

    public TextLabelJson() {
        this.type = "Text";
        this.object_name = "";
        this.text_list = new ArrayList<String>();
    }

    public static TextLabelJson readJSON(String string) {
        GsonBuilder builder = new GsonBuilder();
        Gson gson = builder.create();
        return gson.fromJson(string, TextLabelJson.class);
    }

    public String getType() {
        return this.type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public List<String> getText_list() {
        return this.text_list;
    }

    public void setText_list(List<String> text_list) {
        this.text_list = text_list;
    }

    public int getPosition() {
        return this.position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public int getX() {
        return this.x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return this.y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public boolean isVertical() {
        return this.vertical;
    }

    public void setVertical(boolean vertical) {
        this.vertical = vertical;
    }

    public int getRow_height() {
        return this.row_height;
    }

    public void setRow_height(int row_height) {
        this.row_height = row_height;
    }

    public int getLine_spacing() {
        return this.line_spacing;
    }

    public void setLine_spacing(int line_spacing) {
        this.line_spacing = line_spacing;
    }

    public int getAlign() {
        return this.align;
    }

    public void setAlign(int align) {
        if (align > 3) {
            align = 3;
        }
        if (align < 1) {
            align = 1;
        }
        this.align = align;
    }

    public boolean isReverse_sort() {
        return this.reverse_sort;
    }

    public void setReverse_sort(boolean reverse_sort) {
        this.reverse_sort = reverse_sort;
    }

    public String getObject_name() {
        return this.object_name;
    }

    public void setObject_name(String object_name) {
        this.object_name = object_name;
    }

    public float getScale() {
        return this.scale;
    }

    public void setScale(float scale) {
        this.scale = scale;
    }
}

